import React from "react";
import { Button } from "antd";
import ThemeContext from "../ThemeContext";
/**
 * 方案二：获取祖先上下文中的信息
 *  <ThemeContext.Consumer>
 *  {context=>{
 *      return 渲染的视图；
 * }}
 * </ThemeContext.Consumer>
 */
class VoteFooter extends React.PureComponent {
    render() {
        return <ThemeContext.Consumer>
            {context => {
                let { change } = context;
                return <div className="footer">
                    <Button type="primary" onClick={change.bind(null, 'sup')}>支持</Button>
                    <Button type="primary" danger onClick={change.bind(null, 'opp')}>反对</Button>
                </div>
            }}
        </ThemeContext.Consumer>
    }
}
export default VoteFooter